Page(
  {
    onLoad()
    {
      const app = getApp();
      // console.log(app.data.userInfo);
      const userInfo = app.data.userInfo;
      console.log(userInfo);
    },
     data:
     {
         counter:0,
         userInfo:{},
         colors:["#FF5733", "#33FF57", "#5733FF"],
         chooseImage:""
     },
     
    add()
    {
       console.log("add")
       this.setData({
          counter: this.data.counter+1,
       })
    },
    sub()
    {
      console.log("sub");
      this.setData({
        counter:this.data.counter-1,
      })
    },
    getUserInfo()
    {
       console.log("获取用户信息");
       wx.getUserProfile({
         desc: '用户消息',
       }).then(res=>{
         console.log(res);
       })
    },
    chooseBtn()
    {
      wx.chooseMedia({
         type:"image"
       }).then(res=>{
          const imageUrl = res.tempFiles[0].tempFilePath;
          this.setData({
            chooseImage:imageUrl
          });
          console.log(this.data.chooseImage);
       }) 
    }

     

  }
)